package com.jbbis.portal.calendar.util;

import com.p6spy.engine.logging.appender.Log4jLogger;

public class PuLog4jLogger extends Log4jLogger {

    @Override
    public void logSQL(int connectionId, String now, long elapsed,
            String category, String prepared, String sql) {
        StringBuffer sb = new StringBuffer();
        
        if ("resultset".equals(category)) {
//            category = "ignore resultset";
            return;
        }
        sb.append("now: " + now + "|");
        sb.append("elapsed: " + elapsed + "|");
        sb.append(connectionId == -1 ? "" : String.valueOf(connectionId) + "|");
        sb.append(category + "|");
//        sb.append(prepared + "|");  //The prepared SQL
        
        sql = new BasicFormatterImpl().format(sql);
        String logEntry = sb.append("|" + category + "" + sql).toString();
        logText(logEntry);
    }

}
